package com.example.springboot_demo.order;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @BelongsProject: springboot_demo
 * @BelongsPackage: com.example.springboot_demo.order
 * @Author: 江岸
 * @CreateTime: 2021-06-07 10:05
 * @Description:订单service类
 */
@Service
public class OrderService {


    @Autowired
    private ProductOrederMapper productOrederMapper;

    public List<ProductOrder> findAll(){
        List<ProductOrder> all = productOrederMapper.findAll();
        return all;
    }

    public ProductOrder findById(String id){
        Optional<ProductOrder> byId = productOrederMapper.findById(id);
        return byId.get();
    }

    public ProductOrder update(ProductOrder order){
        ProductOrder save = productOrederMapper.save(order);
        return save;
    }

    public void test(){
        System.out.println("test");
    }
}
